package com.atmk.atmk.designMode.创建型.原型模式.demo2;

import lombok.Data;

import java.util.Arrays;
import java.util.List;

@Data
public class Sheep implements Cloneable{
    private String name;
    private int age;
    private String color;
    private List<String> list;

    public Sheep(String name, int age, String color, List<String> list) {
        this.name = name;
        this.age = age;
        this.color = color;
        this.list = list;
    }
    @Override
    public String toString() {
        return "Sheep{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", color='" + color + '\'' +
                ", list='" + list.toString() + '\'' +
                '}';
    }
    //克隆该实例，使用默认的clone方法来完成
    @Override
    protected Object clone() {
        Sheep sheep = null;
        try {
            sheep = (Sheep) super.clone();
        } catch (CloneNotSupportedException e) {
            System.out.println(e.getMessage());
        }
        return sheep;
    }
}
